//
//  String+i18n.swift
//  LEDSMART
//
//  Created by zj on 2022/9/28.
//  Copyright © 2022 LXF. All rights reserved.
//

import Foundation



extension String{
    
    public static var xx_i18nTableName:[String] = []
    
    
    /// NSLocalizedString(self, comment: self)
    public var i18n:String{
        get{
            var v = NSLocalizedString(self, comment: self)
            if v == self{
                for table in String.xx_i18nTableName {
                    v = NSLocalizedString(self, tableName: table, comment: self)
                    if v != self{
                        return v
                    }
                }
            }
            // 默认
            return v
        }
    }
}


@objc
public extension NSString{
    var i18n:NSString{
        get{
            return (self as String).i18n.asNSString
        }
    }
}
